import axios from 'axios';
import * as constants from './constants';

const changeDetail = (data) => ({
    type: constants.CHANGE_DETAIL,
    workData: data
});

export const getDetail = (id) => {
    console.log(id.slice(7));
    return (dispatch) => {
        axios.get('http://localhost:9080/work/' + id.slice(7)).then((res) => {
            // console.log(res.data);
            dispatch(changeDetail(res.data));
        }).catch((res)=>{
            console.log(res);
        })
    }
}